package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 班级表
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Class对象", description="班级表")
@TableName(value = "v_class",excludeProperty = {"semesterName","teacherName","lifeTeacherName"})

public class Class implements Serializable {
    /**
     * 所有的班级；
     * key 班级Id
     * value 班级名称
     */
    public static Map<Integer,Class > classes = new HashMap<>();

    private static final long serialVersionUID = 1L;

    private String semesterName;
    private String teacherName;
    private String lifeTeacherName;


    public void setTeacherid(Integer teacherid) {
        teacherName = Teacher.teachers.get(teacherid).getTeachername();
        this.teacherid = teacherid;
    }

    public void setLifeteacherid(Integer lifeteacherid) {
        lifeTeacherName = Teacher.teachers.getOrDefault(lifeteacherid,new Teacher()).getTeachername();
        this.lifeteacherid = lifeteacherid;
    }

    public void setSemesterid(Integer semesterid) {
        semesterName = Semester.semester.get(semesterid);
        this.semesterid = semesterid;
    }
@ApiModelProperty("是否毕业了")
    @TableField("isOver")
    private Boolean isOver;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "班级名称")
    @TableField("className")
    private String classname;

    @ApiModelProperty(value = "添加班级时间")
    @TableField("creatTime")
    private Date creattime;

    @ApiModelProperty(value = "学期id")
    @TableField("semesterId")
    private Integer semesterid;

    @ApiModelProperty(value = "班级人数")
    @TableField("classCount")
    private Integer classCount;

    @ApiModelProperty(value = "班规")
    private String stipulate;

    @ApiModelProperty(value = "教员id")
    @TableField("teacherId")
    private Integer teacherid;

    @ApiModelProperty(value = "班主任")
    @TableField("lifeTeacherId")
    private Integer lifeteacherid;


}
